package com.example.laboratory.ui.adapter;

import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
import com.example.laboratory.R;
import com.example.laboratory.bean.Laboratory;
import com.example.laboratory.bean.Record;
import com.example.laboratory.common.ListDataHolder;
import com.example.laboratory.inter.OnRecordListItemClickListener;
import com.example.laboratory.utils.DateUtils;

public class RecordListAdapter extends BaseListAdapter<Record.RecordListBean>{

    private OnRecordListItemClickListener  listener;

    public RecordListAdapter(OnRecordListItemClickListener listener) {
        this.listener = listener;
    }
    @Override
    protected int getLayoutId(int viewType) {
       return R.layout.item_xjrecord_list;
    }


    @Override
    public void bindDatas(ListDataHolder holder, final Record.RecordListBean bean, int itemType, final int position) {
        TextView tv_tag = holder.getView(R.id.tv_tag);
        TextView tv_lab_cate = holder.getView(R.id.tv_lab_cate);
        TextView tv_time = holder.getView(R.id.tv_time);
        TextView tv_lab_name = holder.getView(R.id.tv_lab_name);
        TextView tv_state = holder.getView(R.id.tv_state);
        ImageView img_state = holder.getView(R.id.img_state);

        tv_lab_cate.setText("日常巡检");
        tv_time.setText(DateUtils.parseTime(bean.getGmt_create()));
        tv_state.setText(bean.getState());
        tv_tag.setText("安全");
        tv_lab_name.setText(bean.getLabel());
        holder.itemView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if (listener != null) {
                    listener.onItemClick(position,bean);
                }
            }
        });
    }
}
